package com.aytbayev.resmi;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class NumberFormatter {
	private static final String pattern = "###,###.##"; 
	
	public static String formatFloat(float f){
		if( f != 0){
			DecimalFormatSymbols formatSymbols =  new DecimalFormatSymbols();
		    formatSymbols.setGroupingSeparator(' ');
	
		    DecimalFormat myFormatter = new DecimalFormat( pattern, formatSymbols);
		    return myFormatter.format(f);
		}else{
			return "";
		}
	}
	
	public static String formatInt(int i){
		if( i != 0){
			DecimalFormatSymbols formatSymbols =  new DecimalFormatSymbols();
		    formatSymbols.setGroupingSeparator(' ');
	
		    DecimalFormat myFormatter = new DecimalFormat( pattern, formatSymbols);
		    return myFormatter.format(i);
		}else{
			return "";
		}
	}
}
